package ca.ericslandry;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private String username;
	private String password;

	public String login() {
		Map<String, Object> session = ActionContext.getContext().getSession();
		if (username.equals("dodo") && password.equals("dodo")) {
			session.put("msg", "You are successfully logged in.");
			return SUCCESS;
		}
		session.put("msg", "Username and Password Combination doesnot match (try 'dodo' and 'dodo').");
		return INPUT;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

}
